package com.tulele.vtool.handler;

import com.google.common.collect.Maps;
import com.tulele.vtool.model.ArticleInfo;
import com.tulele.vtool.model.PlatformSysInfo;
import com.tulele.vtool.model.UserBrandInfo;
import com.tulele.vtool.model.reqEntity.*;
import com.tulele.vtool.model.respEntity.RespData;
import com.tulele.vtool.model.respEntity.ReturnCode;
import com.tulele.vtool.service.IArticleInfoService;
import com.tulele.vtool.service.IUserBrandInfoService;
import com.tulele.vtool.service.SysGzhService;
import com.tulele.vtool.utils.AliyunOssClientUtil;
import com.tulele.vtool.utils.DateUtil;
import com.tulele.vtool.utils.SysConstant;
//import com.tulele.vtool.utils.VideoParse;
import com.tulele.vtool.utils.VideoParse;
import com.tulele.vtool.wechat.service.WeixinService;
import com.tulele.vtool.wechat.service.WeixinServiceDL;
import com.tulele.vtool.wechat.service.WeixinServiceMap;
import com.tulele.vtool.wechat.service.WeixinServiceNew;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Slf4j
@RestController
public class FileUploadHandler {

//    @Autowired
//    private WeixinService weixinService;

//    @Autowired
//    private ObjectFactory<WeixinServiceDL> objectFactory;

    @Autowired
    private SysGzhService sysGzhService;

    @Autowired
    private IArticleInfoService articleInfoService;

    @Autowired
    private IUserBrandInfoService userBrandInfoService;

    @RequestMapping(value="/uploadUserQrCodeImg", method = RequestMethod.POST)
    public RespData uploadUserQrCodeImg(@RequestHeader("userId") String userId,  @RequestParam("file") MultipartFile qrCodeImgFile) throws IOException {

        String contentType = qrCodeImgFile.getContentType();

        String fileName = UUID.randomUUID().toString() + ".png";

        String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
        String dirName = SysConstant.USER_QRCODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

        AliyunOssClientUtil.uploadFileByMultipartFile(qrCodeImgFile, dirName + fileName);

        String qrCodeImgUrl = SysConstant.USER_QRCODE_OSS_ACCESS_PREFIX + dirName + fileName;

        log.info("[qrCodeImgUrl] = " + qrCodeImgUrl);

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);

        Map<String, String> resultMap = Maps.newHashMap();
        resultMap.put("qrCodeImgUrl", qrCodeImgUrl);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;
    }

    @RequestMapping(value="/uploadWxUserQrCodeImg", method = RequestMethod.POST)
    public RespData uploadWxUserQrCodeImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive,  @RequestBody UploadWxUserQrCodeImgReqBean uploadWxUserQrCodeImgReqBean) {

        if (uploadWxUserQrCodeImgReqBean  == null || StringUtils.isBlank(uploadWxUserQrCodeImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String qrCodeImgUrl = null;

        String mediaId = uploadWxUserQrCodeImgReqBean.getMediaId();

        log.info("[qrCodeImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());
            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);

            File qrCodeImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = qrCodeImgFile.getName();

            log.info("[qrCodeImgWxFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_QRCODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(qrCodeImgFile, dirName + fileName);

            qrCodeImgUrl = SysConstant.USER_QRCODE_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("qrCodeImgUrl", qrCodeImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    @RequestMapping(value="/uploadWxUserBillImg", method = RequestMethod.POST)
    public RespData uploadWxUserBillImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive,  @RequestBody UploadWxUserQrCodeImgReqBean uploadWxUserQrCodeImgReqBean) {

        if (uploadWxUserQrCodeImgReqBean  == null || StringUtils.isBlank(uploadWxUserQrCodeImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String billImgUrl = null;

        String mediaId = uploadWxUserQrCodeImgReqBean.getMediaId();

        log.info("[qrCodeImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);

            File billImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = billImgFile.getName();

            log.info("[qrCodeImgWxFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_QRCODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(billImgFile, dirName + fileName);

            billImgUrl = SysConstant.USER_QRCODE_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("billImgUrl", billImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    @RequestMapping(value="/uploadUserCommodityImg", method = RequestMethod.POST)
    public RespData uploadUserCommodityImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive,  @RequestBody UploadUserCommodityImgReqBean uploadUserCommodityImgReqBean) {

        if (uploadUserCommodityImgReqBean  == null || StringUtils.isBlank(uploadUserCommodityImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String qrCodeImgUrl = null;

        String mediaId = uploadUserCommodityImgReqBean.getMediaId();

        log.info("[commodityImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);
            File commodityImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = commodityImgFile.getName();

            log.info("[commodityImgWxFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_COMMODITY_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(commodityImgFile, dirName + fileName);

            qrCodeImgUrl = SysConstant.USER_COMMODITY_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("commodityImgUrl", qrCodeImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    @RequestMapping(value="/uploadUserAvatarImg", method = RequestMethod.POST)
    public RespData uploadUserAvatarImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive, @RequestBody UploadUserAvatarImgReqBean uploadUserAvatarImgReqBean) {

        if (uploadUserAvatarImgReqBean  == null || StringUtils.isBlank(uploadUserAvatarImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String avatarImgUrl = null;

        String mediaId = uploadUserAvatarImgReqBean.getMediaId();

        log.info("[avatarImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);
            File avatarImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = avatarImgFile.getName();

            log.info("[avatarImgFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_AVATAR_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(avatarImgFile, dirName + fileName);

            avatarImgUrl = SysConstant.USER_AVATAR_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("avatarImgUrl", avatarImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    @RequestMapping(value="/uploadUserArticleImg", method = RequestMethod.POST)
    public RespData uploadUserArticleImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive, @RequestBody UploadUserArticleImgReqBean uploadUserArticleImgReqBean) {

        if (uploadUserArticleImgReqBean  == null || StringUtils.isBlank(uploadUserArticleImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String avatarImgUrl = null;

        String mediaId = uploadUserArticleImgReqBean.getMediaId();

        log.info("[articleImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816s

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);

            File articleImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = articleImgFile.getName();

            log.info("[articleImgFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_ARTICLE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(articleImgFile, dirName + fileName);

            avatarImgUrl = SysConstant.USER_ARTICLE_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("articleImgUrl", avatarImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    /**
     * 广告商品图片上传
     * 20200509 yl
     * @param userId
     * @param
     * @return
     * @throws IOException
     */
    @RequestMapping(value="/uploadAdvertisingPicture", method = RequestMethod.POST)
    public RespData uploadAdvertisingPicture(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive,  @RequestBody UploadWxUserQrCodeImgReqBean uploadAdvertisingPicture){

        if (uploadAdvertisingPicture  == null || StringUtils.isBlank(uploadAdvertisingPicture.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String advertisingPictureUrl = null;

        String mediaId = uploadAdvertisingPicture.getMediaId();

        log.info("[advertisingPictureMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);
            File advertisingPictureFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = advertisingPictureFile.getName();

            log.info("[advertisingPictureFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_QRCODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(advertisingPictureFile, dirName + fileName);

            advertisingPictureUrl = SysConstant.USER_QRCODE_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("advertisingPictureUrl", advertisingPictureUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;
    }

    /**
     * 通过分享抖音链接，生成视频文章测试接口
     * 2020-10-30
     * @param uploadAdvertisingPicture <分享链接(mediaId)>
     * @return ids<视频文章id>
     */
    @RequestMapping(value="/douYinVideo", method = RequestMethod.POST)
    public RespData douYinVideo(@RequestHeader("userId") String userId,  @RequestBody UploadWxUserQrCodeImgReqBean uploadAdvertisingPicture) throws IOException {

        if (uploadAdvertisingPicture  == null || StringUtils.isBlank(uploadAdvertisingPicture.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;
        }

        String targetPath = uploadAdvertisingPicture.getMediaId();

        ArticleInfo articleInfo = VideoParse.parseUrl(targetPath, userId);

        //添加视频
        int videoArticleId = articleInfoService.addMaterialVideoByDouDouInfo(articleInfo);

        Map<String, Object> resultMap = Maps.newHashMapWithExpectedSize(1);

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        resultMap.put("ids", videoArticleId);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;
    }

    /**
     * 用户上传品牌海报图片
     * 2020-11-07
     * @param uploadUserBandPosterImg <(mediaId)>
     * @return bandPosterImgUrl<图片路径>
     */
    @RequestMapping(value="/uploadUserBandPosterImg", method = RequestMethod.POST)
    public RespData uploadUserBandPosterImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive, @RequestBody UploadUserBandPosterImg uploadUserBandPosterImg) {

        if (uploadUserBandPosterImg  == null || StringUtils.isBlank(uploadUserBandPosterImg.getMediaId()) || uploadUserBandPosterImg.getBrandId() == null) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;
        }

        String bandPosterImgUrl = null;

        String mediaId = uploadUserBandPosterImg.getMediaId();

        log.info("[commodityImgMediaId] = " + mediaId);

        Map<String, Object> resultMap = Maps.newHashMapWithExpectedSize(2);

        try {
//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());

            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);
            File commodityImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = commodityImgFile.getName();

            log.info("[commodityImgWxFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_LONG_TERM_QR_CODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(commodityImgFile, dirName + fileName);

            bandPosterImgUrl = SysConstant.USER_LONG_TERM_QR_CODE_ACCESS_PREFIX + dirName + fileName;

            UserBrandInfo userBrandInfo = new UserBrandInfo();
            userBrandInfo.setUserId(Integer.valueOf(userId));
            userBrandInfo.setBrandId(uploadUserBandPosterImg.getBrandId());
            String brandPoster = uploadUserBandPosterImg.getBrandPoster();
            userBrandInfo.setBrandPoster(brandPoster == null ? bandPosterImgUrl : brandPoster + "," + bandPosterImgUrl);// 逗号分割

            int updateStatus = userBrandInfoService.uploadUserBandPosterImg(userBrandInfo);

            resultMap.put("updateStatus", updateStatus);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }

    /**
     * 上传用户申请提现的二维码
     * @param userId
     * @param springProfilesActive
     * @param uploadWxUserQrCodeImgReqBean
     * @return
     */
    @RequestMapping(value="/uploadWxUserWithdrawQrCodeImg", method = RequestMethod.POST)
    public RespData uploadWxUserWithdrawQrCodeImg(@RequestHeader("userId") String userId,@RequestHeader("identifying") String springProfilesActive,  @RequestBody UploadWxUserQrCodeImgReqBean uploadWxUserQrCodeImgReqBean) {

        if (uploadWxUserQrCodeImgReqBean  == null || StringUtils.isBlank(uploadWxUserQrCodeImgReqBean.getMediaId())) {

            RespData respData = new RespData();
            respData.setCode(ReturnCode.CLIENT_ERROR);
            respData.setMsg("参数异常");
            return respData;

        }

        String qrCodeImgUrl = null;

        String mediaId = uploadWxUserQrCodeImgReqBean.getMediaId();

        log.info("[qrCodeImgMediaId] = " +mediaId);

        Map<String, String> resultMap = Maps.newHashMap();

        try {

//            WeixinServiceDL weixinService= objectFactory.getObject();
//            weixinService.reSetConfigStorage(springProfilesActive);
            //PlatformSysInfo platformSysInfoConfig= sysGzhService.getPlatformSysInfo(springProfilesActive);
            //WxMpServiceImpl weixinService = WeixinServiceNew.getWeixinService(platformSysInfoConfig.getSysGzh());
            springProfilesActive=WeixinServiceMap.getReplaceGzh(springProfilesActive);//找替换的 公众号code 20210816

            WeixinServiceDL weixinService= WeixinServiceMap.getWeixinService(springProfilesActive);

            File qrCodeImgFile = weixinService.getMaterialService().mediaDownload(mediaId);

            String fileName = qrCodeImgFile.getName();

            log.info("[withdrawQrCodeImgWxFileName] = " + fileName);

            String formatDate = DateUtil.getFormatDate("yyyy-MM-dd", DateUtil.getCurDate());
            String dirName = SysConstant.USER_QRCODE_IMG_OSS_DIR + userId + "/" + formatDate + "/";

            AliyunOssClientUtil.uploadFileByLocalFile(qrCodeImgFile, dirName + fileName);

            qrCodeImgUrl = SysConstant.USER_QRCODE_OSS_ACCESS_PREFIX + dirName + fileName;

            resultMap.put("qrCodeImgUrl", qrCodeImgUrl);

        } catch (WxErrorException e) {
            e.printStackTrace();
        }

        RespData respData = new RespData();
        respData.setCode(ReturnCode.NORMAL_SUCC);
        respData.setData(resultMap);
        respData.setMsg("成功");
        return respData;

    }
}
